<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>37.1. ic — Access to the Mac OS X Internet Config &mdash; Python v2.6.2 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.2',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.2 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.2 documentation" href="../index.html" />
    <link rel="up" title="37. Mac OS X specific services" href="mac.html" />
    <link rel="next" title="37.2. MacOS — Access to Mac OS interpreter features" href="macos.html" />
    <link rel="prev" title="37. Mac OS X specific services" href="mac.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="macos.html" title="37.2. MacOS — Access to Mac OS interpreter features"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mac.html" title="37. Mac OS X specific services"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="mac.html" accesskey="U">37. Mac OS X specific services</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-ic">
<h1>37.1. <tt class="xref docutils literal"><span class="pre">ic</span></tt> &#8212; Access to the Mac OS X Internet Config<a class="headerlink" href="#module-ic" title="Permalink to this headline">¶</a></h1>
<p><em>Platforms: </em>Mac</p>
<p>This module provides access to various internet-related preferences set through
<strong>System Preferences</strong> or the <strong>Finder</strong>.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This module is removed in 3.0.</p>
</div>
<p id="index-367">There is a low-level companion module <tt class="xref docutils literal"><span class="pre">icglue</span></tt> which provides the basic
Internet Config access functionality.  This low-level module is not documented,
but the docstrings of the routines document the parameters and the routine names
are the same as for the Pascal or C API to Internet Config, so the standard IC
programmers&#8217; documentation can be used if this module is needed.</p>
<p>The <tt class="xref docutils literal"><span class="pre">ic</span></tt> module defines the <a title="ic.error" class="reference internal" href="#ic.error"><tt class="xref docutils literal"><span class="pre">error</span></tt></a> exception and symbolic names for
all error codes Internet Config can produce; see the source for details.</p>
<dl class="exception">
<dt id="ic.error">
<em class="property">
exception </em><tt class="descclassname">ic.</tt><tt class="descname">error</tt><a class="headerlink" href="#ic.error" title="Permalink to this definition">¶</a></dt>
<dd>Exception raised on errors in the <tt class="xref docutils literal"><span class="pre">ic</span></tt> module.</dd></dl>

<p>The <tt class="xref docutils literal"><span class="pre">ic</span></tt> module defines the following class and function:</p>
<dl class="class">
<dt id="ic.IC">
<em class="property">
class </em><tt class="descclassname">ic.</tt><tt class="descname">IC</tt><big>(</big><span class="optional">[</span><em>signature</em><span class="optional">[</span>, <em>ic</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.IC" title="Permalink to this definition">¶</a></dt>
<dd>Create an Internet Config object. The signature is a 4-character creator code of
the current application (default <tt class="docutils literal"><span class="pre">'Pyth'</span></tt>) which may influence some of ICs
settings. The optional <em>ic</em> argument is a low-level <tt class="docutils literal"><span class="pre">icglue.icinstance</span></tt>
created beforehand, this may be useful if you want to get preferences from a
different config file, etc.</dd></dl>

<dl class="function">
<dt id="ic.launchurl">
<tt class="descclassname">ic.</tt><tt class="descname">launchurl</tt><big>(</big><em>url</em><span class="optional">[</span>, <em>hint</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.launchurl" title="Permalink to this definition">¶</a></dt>
<dt id="ic.parseurl">
<tt class="descclassname">ic.</tt><tt class="descname">parseurl</tt><big>(</big><em>data</em><span class="optional">[</span>, <em>start</em><span class="optional">[</span>, <em>end</em><span class="optional">[</span>, <em>hint</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.parseurl" title="Permalink to this definition">¶</a></dt>
<dt id="ic.mapfile">
<tt class="descclassname">ic.</tt><tt class="descname">mapfile</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#ic.mapfile" title="Permalink to this definition">¶</a></dt>
<dt id="ic.maptypecreator">
<tt class="descclassname">ic.</tt><tt class="descname">maptypecreator</tt><big>(</big><em>type</em>, <em>creator</em><span class="optional">[</span>, <em>filename</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.maptypecreator" title="Permalink to this definition">¶</a></dt>
<dt id="ic.settypecreator">
<tt class="descclassname">ic.</tt><tt class="descname">settypecreator</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#ic.settypecreator" title="Permalink to this definition">¶</a></dt>
<dd>These functions are &#8220;shortcuts&#8221; to the methods of the same name, described
below.</dd></dl>

<div class="section" id="ic-objects">
<h2>37.1.1. IC Objects<a class="headerlink" href="#ic-objects" title="Permalink to this headline">¶</a></h2>
<p><a title="ic.IC" class="reference internal" href="#ic.IC"><tt class="xref docutils literal"><span class="pre">IC</span></tt></a> objects have a mapping interface, hence to obtain the mail address
you simply get <tt class="docutils literal"><span class="pre">ic['MailAddress']</span></tt>. Assignment also works, and changes the
option in the configuration file.</p>
<p>The module knows about various datatypes, and converts the internal IC
representation to a &#8220;logical&#8221; Python data structure. Running the <tt class="xref docutils literal"><span class="pre">ic</span></tt>
module standalone will run a test program that lists all keys and values in your
IC database, this will have to serve as documentation.</p>
<p>If the module does not know how to represent the data it returns an instance of
the <tt class="docutils literal"><span class="pre">ICOpaqueData</span></tt> type, with the raw data in its <tt class="xref docutils literal"><span class="pre">data</span></tt> attribute.
Objects of this type are also acceptable values for assignment.</p>
<p>Besides the dictionary interface, <a title="ic.IC" class="reference internal" href="#ic.IC"><tt class="xref docutils literal"><span class="pre">IC</span></tt></a> objects have the following
methods:</p>
<dl class="method">
<dt id="ic.IC.launchurl">
<tt class="descclassname">IC.</tt><tt class="descname">launchurl</tt><big>(</big><em>url</em><span class="optional">[</span>, <em>hint</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.IC.launchurl" title="Permalink to this definition">¶</a></dt>
<dd>Parse the given URL, launch the correct application and pass it the URL. The
optional <em>hint</em> can be a scheme name such as <tt class="docutils literal"><span class="pre">'mailto:'</span></tt>, in which case
incomplete URLs are completed with this scheme.  If <em>hint</em> is not provided,
incomplete URLs are invalid.</dd></dl>

<dl class="method">
<dt id="ic.IC.parseurl">
<tt class="descclassname">IC.</tt><tt class="descname">parseurl</tt><big>(</big><em>data</em><span class="optional">[</span>, <em>start</em><span class="optional">[</span>, <em>end</em><span class="optional">[</span>, <em>hint</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.IC.parseurl" title="Permalink to this definition">¶</a></dt>
<dd>Find an URL somewhere in <em>data</em> and return start position, end position and the
URL. The optional <em>start</em> and <em>end</em> can be used to limit the search, so for
instance if a user clicks in a long text field you can pass the whole text field
and the click-position in <em>start</em> and this routine will return the whole URL in
which the user clicked.  As above, <em>hint</em> is an optional scheme used to complete
incomplete URLs.</dd></dl>

<dl class="method">
<dt id="ic.IC.mapfile">
<tt class="descclassname">IC.</tt><tt class="descname">mapfile</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#ic.IC.mapfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the mapping entry for the given <em>file</em>, which can be passed as either a
filename or an <tt class="xref docutils literal"><span class="pre">FSSpec()</span></tt> result, and which need not exist.</p>
<p>The mapping entry is returned as a tuple <tt class="docutils literal"><span class="pre">(version,</span> <span class="pre">type,</span> <span class="pre">creator,</span> <span class="pre">postcreator,</span>
<span class="pre">flags,</span> <span class="pre">extension,</span> <span class="pre">appname,</span> <span class="pre">postappname,</span> <span class="pre">mimetype,</span> <span class="pre">entryname)</span></tt>, where <em>version</em>
is the entry version number, <em>type</em> is the 4-character filetype, <em>creator</em> is
the 4-character creator type, <em>postcreator</em> is the 4-character creator code of
an optional application to post-process the file after downloading, <em>flags</em> are
various bits specifying whether to transfer in binary or ascii and such,
<em>extension</em> is the filename extension for this file type, <em>appname</em> is the
printable name of the application to which this file belongs, <em>postappname</em> is
the name of the postprocessing application, <em>mimetype</em> is the MIME type of this
file and <em>entryname</em> is the name of this entry.</p>
</dd></dl>

<dl class="method">
<dt id="ic.IC.maptypecreator">
<tt class="descclassname">IC.</tt><tt class="descname">maptypecreator</tt><big>(</big><em>type</em>, <em>creator</em><span class="optional">[</span>, <em>filename</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.IC.maptypecreator" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the mapping entry for files with given 4-character <em>type</em> and <em>creator</em>
codes. The optional <em>filename</em> may be specified to further help finding the
correct entry (if the creator code is <tt class="docutils literal"><span class="pre">'????'</span></tt>, for instance).</p>
<p>The mapping entry is returned in the same format as for <em>mapfile</em>.</p>
</dd></dl>

<dl class="method">
<dt id="ic.IC.settypecreator">
<tt class="descclassname">IC.</tt><tt class="descname">settypecreator</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#ic.IC.settypecreator" title="Permalink to this definition">¶</a></dt>
<dd>Given an existing <em>file</em>, specified either as a filename or as an <tt class="xref docutils literal"><span class="pre">FSSpec()</span></tt>
result, set its creator and type correctly based on its extension.  The finder
is told about the change, so the finder icon will be updated quickly.</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../contents.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">37.1. <tt class="docutils literal"><span class="pre">ic</span></tt> &#8212; Access to the Mac OS X Internet Config</a><ul>
<li><a class="reference external" href="#ic-objects">37.1.1. IC Objects</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="mac.html"
                                  title="previous chapter">37. Mac OS X specific services</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="macos.html"
                                  title="next chapter">37.2. <tt class="docutils literal"><span class="pre">MacOS</span></tt> &#8212; Access to Mac OS interpreter features</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/library/ic.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="macos.html" title="37.2. MacOS — Access to Mac OS interpreter features"
             >next</a> |</li>
        <li class="right" >
          <a href="mac.html" title="37. Mac OS X specific services"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="mac.html" >37. Mac OS X specific services</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; <a href="../copyright.html">Copyright</a> 1990-2009, Python Software Foundation.
      Last updated on Apr 15, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
    </div>
  </body>
</html>